package src.test01;

import com.rabbitmq.client.CancelCallback;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.DeliverCallback;
import src.util.ConnectionUtil;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: YKH
 * Date: 2023-08-21
 * Time: 20:41
 */
public class Consunmer {
    public static final String QUEUE_NAME = "simple.queue";
    public static void main(String[] args) throws Exception {
        Connection connection = ConnectionUtil.getConnection();
        Channel channel = connection.createChannel();
        DeliverCallback var3 = (consumerTag,message)->{
            System.out.println(new String(message.getBody()));
        };
        CancelCallback var4 = consumerTag -> {
            System.out.println("消费被中断");
        };
        channel.basicConsume(QUEUE_NAME, true, var3, var4);
    }
}
